#!/bin/bash
# Author: Redbrother
# Email: 728083668@qq.com
# WebSite: https://help.ubuntu.com/community/LiveCDCustomizationFromScratch
# license: None
set -e
#自定义版本项

############################################
#root@ubuntu:~# mkdir -p /media/deepin-livecd/squashfs-root
#root@ubuntu:~# mount /dev/sda3 /media/deepin-livecd/
#root@ubuntu:~# mkdir -p /media/deepin-livecd/squashfs-root
#root@ubuntu:~# mount /dev/sda2 /media/deepin-livecd/squashfs-root/
mount -t vfat /dev/sda1 /media/deepin-livecd/squashfs-root/boot/efi/



mkdir -p /media/deepin-livecd/squashfs-root
mount /dev/sdb2 /media/deepin-livecd/squashfs-root/
mkdir -p /media/deepin-livecd/squashfs-root/boot/efi
mount -t vfat /dev/sdb1 /media/deepin-livecd/squashfs-root/boot/efi/
cd /media/deepin-livecd

export LC_ALL=C
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
export installer_url=http://192.168.100.83:8082/deepin/apricot
export RELEASE=apricot
export CURDIR=/media/deepin-livecd
export CHROOT=/media/deepin-livecd/squashfs-root
export PKG_CORE="locales,busybox,systemd,systemd-sysv,initramfs-tools"


debootstrap --no-check-gpg --include=$PKG_CORE --components=main,non-free,contrib --arch=amd64 $RELEASE $CHROOT $installer_url


rm -f etc/resolv.conf
cp -f /etc/resolv.conf etc/
mount -o bind /dev dev/
mount -o bind /sys sys/
mount -o bind /proc proc/
mkdir -p dev/pts
mount -o bind /dev/pts dev/pts/
chroot . rm -f /sbin/initctl
chroot . dbus-uuidgen > /var/lib/dbus/machine-id
chroot . dpkg-divert --local --rename --add /sbin/initctl
chroot . ln -s /bin/true /sbin/initctl
cd ..
	echo -e "mount successfully done"
	echo -e "you can diy it in squashfs-root contents "   







